package cn.hdu.liang.io;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;

import static cn.hdu.liang.io.PATH.FILE_PATH;

public class Exam7 {

    public static void read(String filename) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader(filename));
        String s;
        LinkedList<String> list = new LinkedList<>();
        while((s = in.readLine()) != null) {
            list.addFirst(s);
        }
        in.close();
        list.forEach(System.out::println);
    }

    public static void main(String[] args) throws IOException {
        read(FILE_PATH + "BufferedInputFile.java");
    }

}
